﻿<%@ Page Language="C#" MasterPageFile="~/default.master"  AutoEventWireup="true" CodeBehind="Fileupload.aspx.cs" Inherits="Chinook.Web.MongoDb.Fileupload" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPlaceholder" runat="Server">
    <h1 class="title-regular clearfix">Signup!</h1>
    <p class="inline">
    <div class="notice">
        This sample demonstrates the swf upload control and MongoDb gridfs implementation. 
        For MongoDb connection, this uses the Native MongoDb driver by 10gen technologies & 
        Norm Driver.
    </div>
    <table>           
            <tr>
                <td>
                    Document
                </td>
                <td>
                    <input type="text" id="txtFileName" class="text" disabled="disabled" style="width:300px;"/>
                    <span id="spanButtonPlaceholder"></span>
                   <%-- <div class="fieldset flash" id="fsUploadProgress">--%>
                </td>
            </tr>
            <tr>
                <td>
                    Title
                </td>
                <td>
                    <input type="text" id="txtTitle" class="text" style="width:200px;"/>
                </td>
            </tr>
            <tr>
                <td>
                    Description
                </td>
                <td>
                    <input type="text" id="txtDescription" class="text" style="width:200px;"/>
                </td>
            </tr>        
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                     <asp:Button ID="btnUpload" CssClass="button medium blue" runat="server" Text="Upload" OnClientClick="javascript:doSubmit();return false;"/>                    
                    &nbsp;
                    <asp:Button ID="btnClear" CssClass="button medium black" runat="server" Text="Clear" OnClientClick="javascript:return false;"/>
                </td>
            </tr>
           
        </table>
    </p>
    
<script type="text/javascript">
     var swfu;
     $(function() {
         swfu = new SWFUpload({
             // Backend Settings
             upload_url: "FileUploadHandler.aspx",
             post_params: {
                 "ASPSESSID": "<%=Session.SessionID %>"
             },
             // File Upload Settings
             file_size_limit: "10 MB",
             file_types: "*.*", 		// or you could use something like: "*.doc;*.wpd;*.pdf",
             file_types_description: "All Files",
             file_upload_limit: "0",
             file_queue_limit: "1",


             // Event Handler Settings - these functions as defined in Handlers.js
             //  The handlers are not part of SWFUpload but are part of my website and control how
             //  my website reacts to the SWFUpload events.
             swfupload_loaded_handler: swfUploadLoaded,
             file_dialog_start_handler: fileDialogStart,
             file_queued_handler: fileQueued,
             file_queue_error_handler: fileQueueError,
             file_dialog_complete_handler: fileDialogComplete,
             upload_progress_handler: uploadProgress,
             upload_error_handler: uploadError,
             upload_success_handler: uploadSuccess,
             upload_complete_handler: uploadComplete,

             // Button settings
             //	                button_image_url: "images/XPButtonNoText_160x22.png",
             button_placeholder_id: "spanButtonPlaceholder",
             button_width: 160,
             button_height: 22,
             button_text: '<span class="button">Select Images <span class="buttonSmall">(10 MB Max)</span></span>',
             button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
             button_text_top_padding: 1,
             button_text_left_padding: 5,

             // Flash Settings
             flash_url: "../js/SwfUpload/swfupload.swf", // Relative to this file

             custom_settings: {
                 //upload_target: "divFileProgressContainer",
                 //progressTarget: "fsUploadProgress",
                 upload_successful: false
             },

             // Debug Settings
             debug: false
         });

         swfu.settings.upload_url = '../samples/upload.aspx';
         //debugger;
     });
  
	</script>
</asp:Content>